﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace PilotProject
{
    public partial class TestToken
    {
        public TestToken() { }

        public void AddExaminerID(Examiner _examiner)
        {
            this.ExaminerId = _examiner.Id;
        }
        public void AddCandidate(Candidate candidate)
        {
            this.Candidate = candidate;
        }


        public bool HasTest
        {
            get
            {
                return Test != null; 
            }
        }


        public Test GenerateTest()
        {
            if (!HasTest)
            {
                this.Test = new Test(this);
                Test.TestStatusId = 1;               
            }
            this.TestEngine.LoadQuestions(this);
            return this.Test; 
        }





        [Required]
        [DisplayFormat(DataFormatString = "dd/MM/yy")]       
        [RegularExpression("$1*",ErrorMessage="Is the Date of Birth Correct?")]
        public DateTime selectedTestDate { get; set; }
    }
}
